/**
 * 
 */
package galacticthrone.properties;

import java.io.File;

import javagame.core.properties.AutoProperties;

/**
 * A class that automatically reads the graphics options from file, and then stores
 * them in <code>public static</code> variables for quick global access.<br>
 * 
 * @author Jaco van der Westhuizen
 */
public class VideoOptions extends AutoProperties
{
    private static final File FILE = new File(Paths.PROPERTIES + "video.properties");  // TODO Path properties

    // TODO Find a way to make at least the resolution, depth, refreshRate and aspect ratios part of the standard library.

    /**
     * The horizontal resolution of the window, in pixels.
     */
    public static int xRes = 800;

    /**
     * The vertical resolution of the window, in pixels.
     */
    public static int yRes = 600;
    
    /**
     * The ratio of the screen's width to its height.
     */
    public static float screenAspectRatio = 4.0f / 3.0f;

    /**
     * Whether the window should take over the entire screen.
     */
    public static boolean isFullScreen = false;

    private static boolean isLoaded = false;

    public static int refreshRate = 60;
    
    public static int bitDepth = 24;

    static
    {
        VideoOptions.load();
        isLoaded = true;
    }
    
    protected VideoOptions()
    {
        super();
    }

    /**
     * Loads the video options from file, if it is not yet loaded.
     */
    private static void load()
    {
        if (!isLoaded)
        {
            AutoProperties.load(VideoOptions.class, FILE);
        }
    }

    /**
     * Loads the video options from file, whether it has already been loaded or not.
     */
    public static void reload()
    {
        AutoProperties.load(VideoOptions.class, FILE);
    }
}
